<template>
  <view class="container">
    <!-- 状态栏 -->
    <view class="status-bar">
      <view class="flex items-center">
        <uni-icons type="wifi-filled" size="22" color="#333333" class="mr-2"></uni-icons>
        <uni-icons type="battery" size="22" color="#333333"></uni-icons>
      </view>
    </view>
    
    <!-- 导航栏 -->
    <view class="nav-bar">
      <view class="nav-bar-left" @tap="goBack">
        <uni-icons type="left" size="20" color="#333"></uni-icons>
      </view>
      <view class="nav-bar-title">关于我们</view>
      <view class="nav-bar-right"></view>
    </view>
    
    <!-- 内容区域 -->
    <scroll-view scroll-y class="content-scroll">
      <!-- 餐厅信息 -->
      <view class="restaurant-info">
        <image class="restaurant-logo" src="@/static/logo.png" mode="aspectFill"></image>
        <view class="restaurant-name">和光宴</view>
        <view class="version-text">版本 1.0.0</view>
      </view>
      
      <!-- 分隔线 -->
      <view class="divider"></view>
      
      <!-- 餐厅介绍 -->
      <view class="section">
        <view class="section-title">餐厅介绍</view>
        <view class="section-content">
          <text class="section-text">和光宴创立于2020年，是一家专注于提供精致粤式点心和传统粤式火锅的餐厅。我们秉持"以客为尊，品质至上"的服务理念，致力于为顾客提供优质的餐饮体验。</text>
        </view>
      </view>
      
      <!-- 分隔线 -->
      <view class="divider"></view>
      
      <!-- 联系方式 -->
      <view class="section">
        <view class="section-title">联系方式</view>
        <view class="contact-item">
          <uni-icons type="location" size="20" color="#666"></uni-icons>
          <text class="contact-text">广州市天河区珠江新城XX路XX号</text>
        </view>
        <view class="contact-item">
          <uni-icons type="phone" size="20" color="#666"></uni-icons>
          <text class="contact-text">400-888-8888</text>
        </view>
        <view class="contact-item">
          <uni-icons type="email" size="20" color="#666"></uni-icons>
          <text class="contact-text">contact@heguangyan.com</text>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script setup lang="ts">
// 返回上一页
const goBack = () => {
  try {
    // 检查页面栈
    const pages = getCurrentPages();
    if (pages.length > 1) {
      uni.navigateBack();
    } else {
      // 如果是第一个页面，则切换到"我的"选项卡
      uni.switchTab({
        url: '/pages/mine/index'
      });
    }
  } catch (error) {
    console.error('返回失败:', error);
    // 确保始终有返回方式
    uni.switchTab({
      url: '/pages/mine/index'
    });
  }
};
</script>

<style lang="scss" scoped>
.container {
  min-height: 100vh;
  background-color: #f5f5f5;
  display: flex;
  flex-direction: column;
}

.status-bar {
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fff;
  position: sticky;
  top: 0;
  z-index: 101;
}

.nav-bar {
  height: 88rpx;
  background-color: #fff;
  display: flex;
  align-items: center;
  padding: 0 30rpx;
  position: sticky;
  top: 44px;
  z-index: 100;
}

.nav-bar-left {
  width: 80rpx;
  display: flex;
  align-items: center;
}

.nav-bar-title {
  flex: 1;
  text-align: center;
  font-size: 32rpx;
  font-weight: 500;
}

.nav-bar-right {
  width: 80rpx;
}

.content-scroll {
  flex: 1;
}

.restaurant-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60rpx 0;
  background-color: #fff;
}

.restaurant-logo {
  width: 140rpx;
  height: 140rpx;
  border-radius: 20rpx;
  margin-bottom: 20rpx;
}

.restaurant-name {
  font-size: 36rpx;
  font-weight: bold;
  margin-bottom: 10rpx;
}

.version-text {
  font-size: 28rpx;
  color: #999;
}

.divider {
  height: 20rpx;
  background-color: #f5f5f5;
}

.section {
  padding: 30rpx;
  background-color: #fff;
}

.section-title {
  font-size: 32rpx;
  font-weight: 500;
  margin-bottom: 20rpx;
}

.section-content {
  margin-bottom: 20rpx;
}

.section-text {
  font-size: 28rpx;
  line-height: 1.6;
  color: #666;
}

.contact-item {
  display: flex;
  align-items: center;
  margin-bottom: 30rpx;
}

.contact-text {
  font-size: 28rpx;
  color: #666;
  margin-left: 20rpx;
}
</style> 